package com.du.design.observer;

/**
 * @desc:
 * @author: shuangdu
 * @date: 2022/1/7
 * @since: 1.8
 */
public class Client {

    public static void main(String[] args) {
        WeatherStation weatherStation = new WeatherStation();
        WindowPanel windowPanel = new WindowPanel(weatherStation);
        weatherStation.addObserve(new PhonePanel(weatherStation));
        weatherStation.addObserve(windowPanel);

        weatherStation.setTemperature(36.8D);
        weatherStation.setHumidity(23.0D);

        weatherStation.notifyObserves();

        weatherStation.removeObserve(windowPanel);

        weatherStation.setTemperature(17.2D);
        weatherStation.setHumidity(30.0D);

        weatherStation.notifyObserves();
    }
}
